#define _CRT_SECURE_NO_WARNINGS 1
#include<stdio.h>
#include<math.h>
int JudgePrime(int a, int b)
{
	int i = 2;
	int ret = 1;
	for (; i < b; i++)
	{
		if (a % i == 0 && b % i == 0)
		{
			ret = 0;
			break;
		}
	}
	return ret;
}
int solve(int n, int k)
{
	int count = 0;
	int a = 2;
	int b = 3;
	while (2 <= a && a < n)
	{
		int m = 1;
		while ((a + m * k) < n /* && a < b*/)
		{
			//b = a + m * k;
			m++;
			if (JudgePrime(a, a + m * k))
			{
				printf("%-2d=%-d+%-d*%-d\n", a+m*k, a ,m ,k);
				count++;
			}
		}
		//b = a + 2;
		a++;
	}
	return count;
}
int main()
{
	int n = 0;
	int k = 0;
	scanf("%d%d", &n, &k);
	int ret = solve(n, k);
	printf("%d", ret);
	return 0;
}
